home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Grafik / Misc / ImageEnginer / ARexx / Batch / Neon.ieb < prev    next >
Encoding:
Text File  |  1997-02-02  |  3.3 KB  |  135 lines

  1. /*
  2. ** $VER: Neon.ieb 1.0, IE Arexx script
  3. ** Image Engineer Batch Processing script
  4. ** Copyright © by Patrik M Nydensten
  5. ** 25/1 1997 Stockholm/Sweden
  6. **
  7. ** Creates neon light lines out of image's color edges.
  8. ** Based on the Neon.rexx 1.11 script.
  9. */
  10.  
  11. options results
  12. signal on error
  13.  
  14. parse arg input command
  15. input = upper(strip(input))
  16. address 'IMAGEENGINEER'
  17.  
  18. select  /* Required batch script commands */
  19.   when input = 'INFO' then    return get_info()
  20.   when input = 'CONFIG' then  return get_config(command)
  21.   when input = 'PROCESS' then return process_image(command)
  22.   otherwise do
  23.     'REQUEST' '"Failure in call to batch script!"' '" Quit "'
  24.     return '<ERROR>'
  25.   end
  26. end
  27.  
  28. exit 0
  29.  
  30. /* Required "Get_info" procedure  ------------------------------------ */
  31. /* S = SECONDARY, A = ALPHA, 1 = Single file, 2 = Multiple files       */
  32.  
  33. get_info:
  34.   back = 'OK'
  35. return back
  36.  
  37. /* Required "Get_config" procedure  ---------------------------------- */
  38.  
  39. get_config:
  40.   parse arg '"'command'"'
  41.  
  42.   Thick=3 ; Sharp=1
  43.  
  44.   if command ~= '' then parse var command Thick Sharp
  45.  
  46.   'IE_TO_FRONT'
  47.  
  48.   'FORM "Neon" " OK | Cancel "',
  49.   ' TEXT,"Creates neon light lines from image'x2c(27)'s color edges."',
  50.   ' INTEGER,"Neon thick size",1,12,'Thick',SLIDER',
  51.   ' INTEGER,"Neon sharp size",1,12,'Sharp',SLIDER'
  52.  
  53.   parse var result ok Thick Sharp
  54.   if ok = 0 then return '<ERROR>'
  55.  
  56.   back = Thick Sharp
  57. return back
  58.  
  59. /* Required "Process_image" procedure  ------------------------------- */
  60.  
  61. process_image:
  62.   parse arg '"'src_image'"' '"'dst_image'"' '"'options'"'
  63.   parse var options Thick Sharp
  64.  
  65.   'OPEN' '"'src_image'"' '24'
  66.   if (RC ~= 0) then do
  67.     'IE_TO_FRONT'
  68.     'REQUEST' '"Failed to load image:' d2c(10)||src_image'"' '" OK "'
  69.     return '<ERROR>'
  70.   end
  71.   else LoadImage = Result
  72.  
  73.   Sharp = (Sharp*2-1)
  74.   Thick = (Thick*2-1)
  75.  
  76.   'CONVOLVE' LoadImage '"IE:Convolves/ColourLine_Thin"'
  77.   LineImage = Result
  78.   'CLOSE' LoadImage
  79.  
  80.   if Thick ~= 1 then do
  81.     'MAXIMUM' LineImage Thick Thick
  82.     MaxThickImage = Result
  83.     'LOWPASS' MaxThickImage trunc((2+Thick)/2) trunc((2+Thick)/2)
  84.     ThickImage = Result
  85.     'CLOSE' MaxThickImage
  86.   end
  87.   else ThickImage = LineImage
  88.  
  89.   'MAXIMUM' LineImage Sharp Sharp
  90.   SharpImage = Result
  91.  
  92.   if Thick ~= 1 then 'CLOSE' LineImage
  93.  
  94.   'MARK' ThickImage 'PRIMARY'
  95.   'MARK' SharpImage 'SECONDARY'
  96.  
  97.   'COMPOSITE' 0 0 'ADD'
  98.   OutputImage = Result
  99.  
  100.   'CLOSE' ThickImage
  101.   'CLOSE' SharpImage
  102.  
  103.   if getclip('cfg_save_frmt')='' then setclip('cfg_save_frmt','ILBM CmpByteRun1')
  104.   'SAVE_DATA' OutputImage '"'dst_image'"' '"'getclip('cfg_save_frmt')'"'
  105.   if (RC ~= 0) then do
  106.     'IE_TO_FRONT'
  107.     'REQUEST' '"Failed to save image:' d2c(10)||dst_image'"' '" OK "'
  108.     return '<ERROR>'
  109.   end
  110.   'CLOSE' OutputImage
  111.  
  112.   back = 'OK'
  113. return back
  114.  
  115. /* Internal procedures  ---------------------------------------------- */
  116.  
  117. /*******************************************************************/
  118. /* This is where control goes when an error code is returned by IE */
  119. /* It puts up a message saying what happened and on which line     */
  120. /*******************************************************************/
  121.  
  122. error:
  123. if RC=5 then do
  124.     IE_TO_FRONT
  125.     LAST_ERROR
  126.     'REQUEST "'||RESULT||'"'
  127. end
  128. else do
  129.     IE_TO_FRONT
  130.     LAST_ERROR
  131.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  132. end
  133.  
  134. return '<ERROR>'
  135.